//配置文件
const path = require("path")
const htmlWebpackPlugin = require("html-webpack-plugin")
const vueLoaderPlugin = require("vue-loader/lib/plugin")

module.exports = {
    mode: 'production',
    entry:path.join(__dirname,"./src/main.js"),//入口文件配置
    output:{
        path:path.join(__dirname,"./dist"),//出口文件路径
        filename:"bundle.js"
    },
    module:{
        rules:[
            {test:/\.css/,use:["style-loader","css-loader"]},//css文件解析
            {test:/\.less$/,use:["style-loader","css-loader","less-loader"]},//less文件解析
            {test:/\.(jpg|png|git|svg)$/,use:'url-loader'},//处理css文件中的url
            {test:/\.(eot|svg|ttf|woff|woff2)$/,use:'url-loader'},//处理css文件中的url
            {test:/\.vue$/,use:'vue-loader'},//处理css文件中的url
        ]
    },
    plugins:[
        new htmlWebpackPlugin({
            template:path.join(__dirname,"./src/index.html"),
            filename:"index.html"
        }),
        new vueLoaderPlugin(),
    ]
}